<template>
  <div class="status-bar">
    <div class="status-left">
      <el-tag :type="statusType">{{ status }}</el-tag>
      <span class="status-text">{{ statusText }}</span>
      <span v-if="fileInfo" class="file-info">
        {{ fileInfo }}
      </span>
    </div>
    <div class="status-right">
      <el-button 
        text 
        size="small" 
        @click="$emit('toggleLog')"
      >
        <el-icon><Document /></el-icon>
        {{ showLog ? $t('toolbar.hideLog') : $t('toolbar.showLog') }}
      </el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'

const { t } = useI18n()

// Props
const props = defineProps<{
  status: string
  statusText: string
  statusType?: string
  fileInfo?: string
  showLog?: boolean
}>()

// Emits
const emit = defineEmits<{
  toggleLog: []
}>()

// 计算状态类型
const statusType = computed(() => {
  return props.statusType || 'info'
})
</script>

<style scoped>
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #2d2d30;
  border-top: 1px solid #3e3e42;
  font-size: 12px;
  color: #cccccc;
  flex-shrink: 0;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-text {
  color: #e0e0e0;
  font-family: 'Consolas', 'Monaco', monospace;
}

.file-info {
  color: #888;
  font-size: 11px;
}

.status-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .status-bar {
    padding: 6px 12px;
    font-size: 11px;
  }
  
  .status-left {
    gap: 8px;
  }
  
  .status-text {
    font-size: 11px;
  }
  
  .file-info {
    display: none;
  }
}

@media (max-width: 480px) {
  .status-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .status-left {
    margin-bottom: 4px;
  }
}
</style>
